import {useState} from "react";

export default function Demo() {
    const [count, setCount] = useState(0)
    const [msg, setMsg] = useState("")

    const handle = () => {
        setCount(count + 1)
    }

    const handleMsg = () => {
        setMsg("点击按钮传入的值")
    }

    return (
        <div>
            <div>
                value in state：{count}
            </div>
            <button onClick={handle}>点我改变state里的值</button>
            <div>
                value in state：{msg}
            </div>
            <button onClick={handleMsg}>点我改变state里的值</button>
        </div>
    )
}
